<style lang="less">
  .item1{
    height: 42px;
    line-height: 40px;
  }
  .row-left{
    text-align: center;
  }
  .title-top{
    margin-bottom:10px;
    color: #1C86EE;
    font-size: 1rem;
    border-bottom: 1px solid orangered;
    font-size: 20px;
    color: coral;
  }
  .content-submit{
    background-color:white;
    height: auto;
  }
  .idCard{
    width: 170px;
    height: 80px;
    background-color: #79e428;
    position: absolute;
    right: 2%;
    top: 13%;
    color: white;
    font-size: 1.5rem;
    line-height: 80px;
    text-align: center;
  }
  .red-name{
    color: red
  }
  .ivu-steps-item {
    display: initial;
    position: relative;
    vertical-align: initial;
  }
  .step-item {
    float: left;
    margin-left: 0px;
  }
</style>
<template>
  <div style="background-color:white">
    <div style="">
      <!-- <Row class="title-top">
        <Col span="4" style="text-align: left;width:22%">城市低保救助申请登记</Col>
      </Row> -->
    </div>
    <div style="height:30px">
      <Steps :current="10" size="small">
        <div @click="nextStep('0')" class="step-item">
          <Step title="家庭信息" content=""></Step>
        </div>
        <div @click="nextStep('1')" class="step-item">
          <Step title="家庭成员" content=""></Step>
        </div>
        <div @click="nextStep('2')" class="step-item">
          <Step title="基础收入" content=""></Step>
        </div>
        <div @click="nextStep('3')" class="step-item">
          <Step title="基础支出" content=""></Step>
        </div>
        <div @click="nextStep('4')" class="step-item">
          <Step title="赡抚扶养" content=""></Step>
        </div>
        <div @click="nextStep('5')" class="step-item">
          <Step title="基础财产" content=""></Step>
        </div>
        <div @click="nextStep('6')" class="step-item">
          <Step title="财产房产" content=""></Step>
        </div>
        <div @click="nextStep('7')" class="step-item">
          <Step title="工作单位" content=""></Step>
        </div>
        <div @click="nextStep('8')" class="step-item">
          <Step title="教育情况" content=""></Step>
        </div>
        <div @click="nextStep('9')" class="step-item">
          <Step title="家庭附件" content=""></Step>
        </div>
        <div @click="nextStep('10')" class="step-item">
          <Step title="提交信息" content=""></Step>
        </div>
      </Steps>
    </div>
    <div class="content-submit">
      <Form ref="paramData" :model="paramData" :rules="ruleValidate">
        <Row class="item1">
          <Col span="17" style="text-align: center" class="red-name">该页面信息填写，点击“完成”按钮后数据将直接提报到社会救助系统，无法在全市通办再进行信息修改！！！</Col>
        </Row>
        <!-- <Row class="item1">
          <Col span="5" style="text-align: center" class="red-name">开户银行名称:</Col>
          <Col span="6">
            <Select v-model="paramData.ssca0009">
              <Option :value="obj.key" v-for="obj in data2.BankCategoryDict" v-bind:key="obj.key">{{obj.value}}</Option>
            </Select>
          </Col>
          <Col span="5" style="text-align: center" class="red-name">开户人姓名:</Col>
          <Col span="6">
            <Input v-model="paramData.ssca0010" placeholder="开户人姓名"></Input>
          </Col>
        </Row> -->
        <!-- <Row class="item1">
          <Col span="5" style="text-align: center" class="red-name">银行卡账号:</Col>
          <Col span="6">
            <Input v-model="paramData.ssca0011" placeholder="开户银行账号"></Input>
          </Col>
          <Col span="5" style="text-align: center" class="red-name">银行卡账号确认录入:</Col>
          <Col span="6">
            <Input v-model="paramData.ssca0012" placeholder="银行卡账号确认录入"></Input>
          </Col>
        </Row> -->
        <Row class="item1">
          <Col span="5" style="text-align: center" class="red-name">申请时间:</Col>
          <Col span="6">
            <DatePicker type="date" v-model="paramData.ssca0014" style="width: 289px"></DatePicker>
          </Col>
          <Col span="5" style="text-align: center" class="red-name">致贫原因:</Col>
              <Col span="6">
                <Select v-model="paramData.ssca0013">
                  <Option :value="obj.key" v-for="obj in data2.PoorReasonDict" v-bind:key="obj.key">{{obj.value}}</Option>
                </Select>
              </Col>
        </Row>
        <Row class="item1">
          <Col span="5" style="text-align: center" class="red-name">救助申请理由:</Col>
          <Col span="17">
            <Input v-model="paramData.ssca0008" type="textarea" :autosize="{minRows: 2,maxRows: 5}" />
          </Col>
        </Row>
      </Form>
    </div>
    <div style="height:40px;line-height:40px;float:left;margin-top:10px;margin-left:40%">
      <Button :disabled="order_state == '1' || order_state == '2' || order_state == '3'" type="info" @click="complete()">完成</Button>
    </div>
  </div>
</template>
<script>
import { getCityDBAppraising } from '@/api/subsistenceAlowances'
import { iteminf, updateOrder, date2str } from '@/api/eventlist'
export default {
  data () {
    return {
      flow: '',
      query_attachment_url: '',
      family_url: '',
      support_id: '',
      family_idInfo: {},
      next_params: {},
      itemid: this.$route.params.itemid || '',
      attachment_url: '',
      info_url: '',
      add_url: '',
      update_url: '',
      delete_url: '',
      see: this.$route.params.see || false,
      code: this.$route.params.code,
      url: '',
      str: this.$route.params.serialNumber,
      idcardNumber: this.$route.params.idcardNumber,
      ss11001Id: this.$route.params.ss11001Id,
      ss11002Id: this.$route.params.ss11002Id,
      order_state: this.$route.params.order_state,
      paramData: {
      },
      ruleValidate: {
        name: [
          { required: true, message: 'The name cannot be empty', trigger: 'blur' }
        ]
      },
      data1: [],
      data2: [],
      data3: [],
      modal: false,
      form_params: {
        ss11001Data: {},
        ss11002Data: [],
        ss11003Data: [],
        ss11004Data: [],
        ss11005Data: [],
        ss11006Data: [],
        ss11007Data: [],
        ss11008Data: [],
        ss11009Data: [],
        ss11010Data: [],
        ss11012Data: [],
        ss12001Data: {}
      },
      receive_arr: [],
      id: '',
      paramIndex: ''
    }
  },
  methods: {
    nextStep (step) {
      if (step === '0') {
        this.$router.push({
          name: 'db_subsistenceapplication',
          params: this.next_params
        })
      } else if (step === '1') {
        this.$router.push({
          name: 'db_subsistenceapplication1',
          params: this.next_params
        })
      } else if (step === '2') {
        this.$router.push({
          name: 'db_subsistenceapplication2',
          params: this.next_params
        })
      } else if (step === '3') {
        this.$router.push({
          name: 'db_expenditurelist',
          params: this.next_params
        })
      } else if (step === '4') {
        this.$router.push({
          name: 'db_supportlist',
          params: this.next_params
        })
      } else if (step === '5') {
        this.$router.push({
          name: 'basicproperty',
          params: this.next_params
        })
      } else if (step === '7') {
        this.$router.push({
          name: 'db_workunit',
          params: this.next_params
        })
      } else if (step === '8') {
        this.$router.push({
          name: 'db_educationinfo',
          params: this.next_params
        })
      } else if (step === '9') {
        this.$router.push({
          name: 'db_nearfamily',
          params: this.next_params
        })
      }
    },
    // 获取数据字典数据
    getInfo () {
      var param = {
        'idcardNumber': this.idcardNumber,
        'dictsCode': 'ss12001',
        'serialNumber': this.str
      }
      getCityDBAppraising(param).then(res => {
        this.data2 = res.data.data.data
      })
    },
    complete () {
      console.log(this.paramData)
      this.ssca0014 = date2str(this.ssca0014)
      // if (this.paramData.ssca0009 === '' || this.paramData.ssca0009 === undefined) {
      //   const content = '<p>请选择开户行名称</p>'
      //   this.$Modal.error({
      //     title: this.errorTitle,
      //     content: content
      //   })
      //   return
      // }
      // if (this.paramData.ssca0010 === '' || this.paramData.ssca0010 === undefined) {
      //   const content = '<p>请填写开户人姓名</p>'
      //   this.$Modal.error({
      //     title: this.errorTitle,
      //     content: content
      //   })
      //   return
      // }
      // if (this.paramData.ssca0011 === '' || this.paramData.ssca0011 === undefined) {
      //   const content = '<p>请填写银行卡账号</p>'
      //   this.$Modal.error({
      //     title: this.errorTitle,
      //     content: content
      //   })
      //   return
      // }
      // if (this.paramData.ssca0012 === '' || this.paramData.ssca0012 === undefined) {
      //   const content = '<p>请再次录入银行卡账号</p>'
      //   this.$Modal.error({
      //     title: this.errorTitle,
      //     content: content
      //   })
      //   return
      // }
      if (this.paramData.ssca0014 === '' || this.paramData.ssca0014 === undefined) {
        const content = '<p>请选择申请时间</p>'
        this.$Modal.error({
          title: this.errorTitle,
          content: content
        })
        return
      }
      if (this.paramData.ssca0013 === '' || this.paramData.ssca0013 === undefined) {
        const content = '<p>请填致贫原因</p>'
        this.$Modal.error({
          title: this.errorTitle,
          content: content
        })
        return
      }
      if (this.paramData.ssca0008 === '' || this.paramData.ssca0008 === undefined) {
        const content = '<p>请填写救助申请理由</p>'
        this.$Modal.error({
          title: this.errorTitle,
          content: content
        })
        return
      }
      this.form_params.ss12001Data = this.paramData
      var param = {
        item_id: this.$route.params.itemid,
        cardno: this.$route.params.cardno,
        form_params: this.form_params,
        code: this.$route.params.code
      }
      updateOrder(param).then(res => {
        if (res.data.errcode === 0) {
          this.$Message.success(res.data.errmsg)
          this.$router.push({
            name: 'workbench'
          })
        } else {
          const content = '<p>' + res.data.errmsg + '</p>'
          this.$Modal.error({
            title: this.errorTitle,
            content: content
          })
        }
      })
    }
  },
  mounted () {
    let param2 = {
      'cardno': this.$route.params.cardno,
      'id': this.$route.params.itemid,
      'code': this.$route.params.code,
      'params': '1'
    }
    // this.getuserinfo(param2.cardno)
    iteminf(param2).then(res => {
      if (res.data.data) {
        if (JSON.parse(res.data.data.form_params).ss11001Data) {
          this.form_params.ss11001Data = JSON.parse(res.data.data.form_params).ss11001Data
        }
        if ((JSON.parse(res.data.data.form_params)).ss11002Data) {
          this.form_params.ss11002Data = JSON.parse(res.data.data.form_params).ss11002Data
          // this.dataF1[0] = JSON.parse(res.data.data.form_params).ss11002Data
        }
        if (JSON.parse(res.data.data.form_params).ss11003Data) {
          this.form_params.ss11003Data = JSON.parse(res.data.data.form_params).ss11003Data
        }
        if (JSON.parse(res.data.data.form_params).ss11004Data) {
          this.form_params.ss11004Data = JSON.parse(res.data.data.form_params).ss11004Data
        }
        if (JSON.parse(res.data.data.form_params).ss11005Data) {
          this.form_params.ss11005Data = JSON.parse(res.data.data.form_params).ss11005Data
        }
        if (JSON.parse(res.data.data.form_params).ss11006Data) {
          this.form_params.ss11006Data = JSON.parse(res.data.data.form_params).ss11006Data
        }
        if (JSON.parse(res.data.data.form_params).ss11007Data) {
          this.form_params.ss11007Data = JSON.parse(res.data.data.form_params).ss11007Data
        }
        if (JSON.parse(res.data.data.form_params).ss11008Data) {
          this.form_params.ss11008Data = JSON.parse(res.data.data.form_params).ss11008Data
        }
        if (JSON.parse(res.data.data.form_params).ss11009Data) {
          this.form_params.ss11009Data = JSON.parse(res.data.data.form_params).ss11009Data
        }
        if (JSON.parse(res.data.data.form_params).ss11010Data) {
          this.form_params.ss11010Data = JSON.parse(res.data.data.form_params).ss11010Data
        }
        if (JSON.parse(res.data.data.form_params).ss11012Data) {
          this.form_params.ss11012Data = JSON.parse(res.data.data.form_params).ss11012Data
        }
        if (JSON.parse(res.data.data.form_params).ss12001Data) {
          this.form_params.ss12001Data = JSON.parse(res.data.data.form_params).ss12001Data
          this.paramData = this.form_params.ss12001Data
          console.log(this.form_params.ss12001Data, 'json')
        }
      }
    })
    this.next_params = {
      serialNumber: this.$route.params.serialNumber,
      idcardNumber: this.$route.params.idcardNumber,
      code: this.$route.params.code,
      cardno: this.$route.params.cardno,
      itemid: this.itemid,
      order_state: this.order_state,
      uuid: this.$route.params.uuid
    }
    // 列表
    this.getInfo()
  }
}
</script>
